package edu.neusoft.springhtmldemo.mapper;

import edu.neusoft.springhtmldemo.domain.LogManagement;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface LogManagementMapper {

    @Select("select * from maintainlogentity")
    List<LogManagement> showLogManagement();

    @Select("select * from maintainlogentity where maintainNum like '%' #{maintainNum} '%' " +
            "and maintainBeginTime like '%' #{maintainBeginTime} '%'" +
            "and maintainEndTime like '%' #{maintainEndTime} '%'" +
            "and maintainer like '%' #{maintainer} '%'")
    List<LogManagement> selectLogManagement(String maintainNum, String maintainBeginTime, String maintainEndTime, String maintainer);

    @Select("update maintainlogentity set maintainer=#{maintainer},maintainContent=#{maintainContent} where maintainNum=#{maintainNum}")
    void updateUserLogManagement(LogManagement logManagement);

    @Select("insert into maintainlogentity(maintainBeginTime,maintainer,maintainContent,maintainEndTime) " +
            "value(#{maintainBeginTime},#{maintainer},#{maintainContent},#{maintainEndTime})")
    void addLogManagement(LogManagement management);
}
